Iso14CE.ActivateCardAPDU
This command starts the reader's passive mode, emulating an ISO14443-4 compatible card, and returns the first APDU request received.
The emulated PICC answers all ISO14443-3 request, anticollision and select commands. It utilizes the 4-Byte serial number specified in the Snr parameter. The Byte order corresponds to ISO14443-3: The first Byte (uid0) will be transmitted first to the reader. It has to be 0x08 as this indicates a random serial number.
To identify potential errors, the PCD starts a timer within which the PICC has to respond, after sending out each frame. This time duration is the so-called frame waiting time (FWT). FWT is determined by the PICC during protocol activation and is valid for all further communication. This parameter should be chosen as large as required, but as small as possible. The communication speed between card emulator and host and the processing speed of the host should be taken into consideration. It is possible to increase the FWT temporarily for a single frame by calling the Iso14CE.ExtendWaitingTime command. Since the ISO14443 protocol specification only allows discrete FWT values, the firmware calculates the lowest value that meets the specified waiting time according to the equation
FWI = (256 * 16 / fc) * 2 ^ FWT,
where fc is the RFID carrier frequency. The highest possible FWT value is 4949 ms.
2 timeout parameters triggering a timer have to be specified for this command:
- The first timer, associated with the TimeoutPCD parameter, is used for the card activation sequence. Card activation is complete once the emulated PICC has received the RATS command. If the emulated PICC doesn't receive the required protocol activation sequence within TimeoutPCD, this command will return an Iso14CE.ErrIso144State status code. For TimeoutPCD, we recommend a value of 1000 ms - this provides the best results for the protocol activation sequence.
- The second timer is optional (default value: 100 ms) and associated with the TimeoutApdu parameter. It stops as soon as the emulated PICC has received an optional PPS command frame or an APDU Exchange command after the RATS command as defined in ISO14443-4. If the emulated PICC doesn't receive anything within TimeoutApdu, this command will return an Iso14CE.ErrIso144State status code. Otherwise, the first APDU request is returned in the command's response.
The ATS (historical bytes) the card emulation shall use may be specified by the ATS parameter if required. This parameter may also be left out, in which case no historical bytes are sent.
As already mentioned, ISO14443-4 specifies that a card has to send a response within FWT ms. The command I4CE.ExtendWaitingTime can be called to extend this time temporarily if the host cannot prepare the APDU within the defined FWT time. A more convenient way to perform this action is to use the automatic WTX mode: If the parameter AutoWTX is set to 1, the card emulation will automatically transmit WTX requests periodically every 0.9 * FWT ms after the successful execution of the Iso14CE.StartEmu command and of all subsequent Iso14CE.ExchangeCardAPDU commands. In practice, this allows to ignore the FWT limits, since the card emulation itself keeps the communication with the PCD alive.
Properties
- Command code: 0x4A01
- Command timeout: 2000 ms
- Possible status codes: General status codes, Iso14CE.ErrIso144State, Iso14CE.ErrCom, Iso14CE.ErrTransmission, Iso14CE.ErrTimeout, Iso14CE.ErrOverflow, Iso14CE.ErrInternal, Iso14CE.ErrDeselect
Parameters (request frame)
Name | Type/Size | Description | |
---|---|---|---|
Mode | Bit mask (8 bits) | - | |
RFU | Integer (bit mask area 0xFC) |
Zero padding |
|
SpecifyTimeoutApdu | Boolean (bit 0x02) | Has to be set if the TimeoutApdu parameter is present. | |
AutoWTX | Boolean (bit 0x01) | Enable/disable automatic Waiting Time Extension | |
ATQA | Integer (16 bits) | Attention: When transferred via HF, the ATQA is sent LSB (instead of the MSB order used here). | |
Snr | Raw data (length 4 Bytes) |
Card serial number of the emulated PICC according to the ISO14443-3 specification (uid0, uid1, uid2, uid3). |
|
DSDR | Bit mask (8 bits) | - | |
DSEqualToDR | Boolean (bit 0x80) | Same D for both directions | |
DS8 | Boolean (bit 0x40) | supports 848 kBit PICC -> PCD | |
DS4 | Boolean (bit 0x20) | supports 424 kBit PICC -> PCD | |
DS2 | Boolean (bit 0x10) | supports 212 kBit PICC -> PCD | |
RFU | Integer (bit 0x08) |
Zero padding |
|
DR8 | Boolean (bit 0x04) | supports 848 kBit PCD -> PICC | |
DR4 | Boolean (bit 0x02) | supports 424 kBit PCD -> PICC | |
DR2 | Boolean (bit 0x01) | supports 212 kBit PCD -> PICC | |
FWT | Integer (16 bits) |
Frame waiting time in ms. This is the maximum time the PCD waits for the next PICC response. If FWT is set to 0xFFFF the default frame waiting time of 77.328 ms will be applied. |
|
TimeoutPCD | Integer (16 bits) |
Maximum time (in ms) to wait for card activation. Card activation is complete after the PICC has received the RATS command. A value of 0xFFFF corresponds to an infinite time. |
|
Optional field, condition: SpecifyTimeoutApdu | |||
TimeoutApdu | Integer (16 bits) |
Maximum time (in ms) to wait for an optional Apdu or the first ISO14443-4 APDU after the first received PCD frame. This value is optional - if not given as a parameter, it's set to 100ms. A value of 0xFFFF corresponds to an infinite time. |
|
Length of ATS | Integer (8 bits) |
Length of ATS in bytes |
|
ATS | Raw data | ATS (Historical Bytes) to use for card emulation. |
Returned values (response frame)
Name | Type/Size | Description |
---|---|---|
Length of FirstCmd | Integer (16 bits) |
Length of FirstCmd in bytes |
FirstCmd | Raw data | First ISO14443-4 APDU request received from the PCD. |